package com.csun.nusing.ui.activity;

import android.text.format.Time;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.ImageView;
import android.widget.ProgressBar;
import android.widget.TextView;

import com.csun.nusing.R;
import com.csun.nusing.presenter.CommonPresenter;
import com.csun.nusing.presenter.inter.IBase;
import com.csun.nusing.ui.BaseActivity;

import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * 手表界面 ClassName: WatchDetailActivity
 * 
 * @Description: 显示手表数据
 * @author fzq
 * @date 2017-10-26
 */
public class WatchDetailActivity extends BaseActivity<CommonPresenter>
		implements IBase {

	private TextView tvheartbeat;
	private TextView tvblood;
	private TextView tvsport;
	private TextView tvmlocation;
	private TextView nowday;
	private ImageView watchback;
	private ProgressBar watchbar;

	@Override
	public int getContentViewId() {
		return R.layout.activity_watch_detail;
	}

	@Override
	public void initSubViews(View view) {
		super.initSubViews(view);
		findView();
	}

	/**
	 * 初始化控件
	 * 
	 * @Description: TODO
	 * @param
	 * @return void
	 * @throws
	 * @author fzq
	 * @date 2017-10-26
	 */
	private void findView() {
		tvheartbeat = findViewById(R.id.watch_tv_heartbeat);
		tvblood = findViewById(R.id.watch_tv_blood);
		tvsport = findViewById(R.id.watch_tv_sport);
		tvmlocation = findViewById(R.id.watch_tv_mlocation);
		nowday = findViewById(R.id.watch_day_tv);
		watchback = findViewById(R.id.watch_back);
		watchbar = findViewById(R.id.watch_bar);
		watchback.setOnClickListener(new OnClickListener() {
			@Override
			public void onClick(View arg0) {
				finish();
			}
		});

		// tvblood.setText(watchInfo.blood);
		// tvheartbeat.setText(watchInfo.heat);
		// tvsport.setText(watchInfo.action);
		// tvmlocation.setText(addtstr);
		// watchbar.setProgress(Integer.parseInt(watchInfo.action));
		Time t = new Time(); // or Time t=new Time("GMT+8"); 加上Time Zone资料。
		t.setToNow(); // 取得系统时间。
		int month = t.month + 1;
		int date = t.monthDay;
		long time = System.currentTimeMillis();
		Date mdate = new Date(time);
		SimpleDateFormat format = new SimpleDateFormat("E");
		nowday.setText(String.valueOf(month) + getString(R.string.month) + String.valueOf(date) + getString(R.string.day)
				+ " " + format.format(mdate));
	}

	@Override
	public void initData() {
		super.initData();
	}

}
